package servlet.servlet_yaobo;

import pojo.MembershipManagement;
import pojo.User;
import service.impl.ImpShoppingMemberService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 用于根据id获取对应对象
 */
@WebServlet(value = "/obtain")
public class DataModificationServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       String uID=req.getParameter("u_id");

       if(uID==null){
            resp.sendRedirect("Mem.jsp");
       }
        ImpShoppingMemberService imp=new ImpShoppingMemberService();
        User me=new User();
        me=imp.appoint(Integer.parseInt(uID));
        req.setAttribute("me",me);
        req.getRequestDispatcher("modify.jsp").forward(req,resp);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
